#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <sys/time.h>

/*
 * 取得当地目前UTC时间和日期
 */

void localtime_test()
{
  char * wday[] = {"Sun", "Wed", "Tue", "Wed", "Thu", "Fri", "Sat"};
  time_t timep;
  struct tm * p;

  time(&timep);
  p = localtime(&timep);

  printf("%d-%d-%d ", (1990 + p->tm_year), (1 + p->tm_mon), p->tm_mday);
  printf("%s %d:%d:%d\n", wday[p->tm_wday], p->tm_hour, p->tm_min, p->tm_sec);
}

void main()
{
  localtime_test();
}
